package com.data.unityplugin_market.business.center

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.data.unityplugin_market.base.BaseFragment
import com.data.unityplugin_market.config.HttpConfig
import com.data.unityplugin_market.model.req.ReqDeleteGoods
import com.data.unityplugin_market.model.req.ReqGetCustomerInfo
import com.data.unityplugin_market.network.NetWorkConfig
import com.data.unityplugin_market.network.RetrofitService
import com.data.unityplugin_market_lib.R
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

public class CustomerFragment : BaseFragment(){



    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {

        var view : View = inflater.inflate(R.layout.fragment_customer_center,null)
        var qq   = view.findViewById<TextView>(R.id.qq);
        var phone = view.findViewById<TextView>(R.id.phonenumber);

        var req = ReqGetCustomerInfo()


        NetWorkConfig.instance.retrofit.create(RetrofitService::class.java)
                .getCustomerInfo(req, HttpConfig.GET_CUSTOMER_INFO, HttpConfig.getBaseKeyMap())
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).doOnSubscribe {}
                .subscribe({

                    qq.text = "QQ:" + it.results!!.qq
                    phone.text = "电话:" + it.results!!.phone

                }, {

                })


        return view

    }
}